#!/usr/bin/env perl

use utf8;
use strict;
no warnings 'experimental::smartmatch';
use 5.010001;

my $path = shift @ARGV;

opendir my $dh, $path or die "Can't open dir $path";

printf "%50s <---> \n", '-' x 50;

foreach(readdir $dh){
	printf "%50s <---> ", $_;

	when(! -e){
		print "file not exist\n";
	}
	when(-r _){
		print "r\t\t";
		continue;
	}
	when(-w _){
		print "w\t\t";
		continue;
	}
	when(-x _){
		print "x\t\t";
		continue;
	}

	print "\n";
}